package mornd.test1;

import lombok.extern.slf4j.Slf4j;
import mornd.test1.annotation.Token;
import mornd.test1.annotation.Yml;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author: mornd
 * @dateTime: 2023/5/7 - 15:48
 */

@Slf4j
@Controller
public class Controller1 {

    @RequestMapping("/test1")
    public ModelAndView test1() {
        log.debug("test1");
        return null;
    }

    @PostMapping("/test2")
    public Object test2(@RequestParam(name = "name") String name) {
        log.debug("test2-{}", name);
        return null;
    }

    @GetMapping("/test3")
    public ModelAndView test3(@Token String token, String name) {
        log.debug("test3-{}-{}", token, name);
        return null;
    }

    @GetMapping("/test4")
    @Yml
    public User test4() {
        log.debug("test4");
        return new User(1, "李四");
    }
}
